using System;
using System.Collections.Generic;
using System.IO;
using System.Text;

namespace Prydocon.Mpower.MpxAddressUpdateUtility
{
    public class AccountImportErrorLogWriter
    {
        string logFileName;
        private TextWriter textWriter;

        public AccountImportErrorLogWriter(string logFileName)
        {
            this.logFileName = logFileName;
        }

        public void WriteAccountToErrorLog(string text)
        {
            if (textWriter == null)
            {
                // create a writer and open the file
                textWriter = new StreamWriter(logFileName, false);
            }

            // write a line of text to the file
            textWriter.WriteLine(text);
            textWriter.Flush();
        }

        public void Close()
        {
            if (textWriter != null)
                textWriter.Close();
        }
    }
}
